package com.dingding.common.core.intital;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

import com.dingding.common.core.config.AbstractConfig;
import com.dingding.common.core.config.AbstractConfigManager;
import com.dingding.common.core.config.AbstractConfigManagerImpl;
import com.dingding.common.core.config.EmailConfig;
import com.dingding.common.core.config.ImageUploadConfig;
import com.dingding.common.core.config.JPushConfig;
import com.dingding.common.core.config.MessageQueueConfig;
import com.dingding.common.core.config.RedisConfig;
import com.dingding.common.core.config.SystemConfig;
import com.dingding.common.core.config.SystemKeyConfig;
import com.dingding.common.core.config.WeChatConfig;

public class IntitalBean implements BeanFactoryPostProcessor {

	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		// 文件上传配置对象
		AbstractConfig imageUploadConfig = new ImageUploadConfig();
		// 邮件发送配置对象
		AbstractConfig emailConfig = new EmailConfig();
		// 极光推送配置对象
		AbstractConfig jpushConfig = new JPushConfig();
		// Redis 配置对象
		AbstractConfig redisConfig = new RedisConfig();
		// 消息队列配置对象
		AbstractConfig queue_config = new MessageQueueConfig();
		// 微信支付
		AbstractConfig wechat_pay = new WeChatConfig();
		// 秘钥配置类
		AbstractConfig systemKeyConfig = new SystemKeyConfig();
		// 系统配置
		AbstractConfig systemConfig = new SystemConfig();

		AbstractConfigManager abstractConfigManager = new AbstractConfigManagerImpl();
		abstractConfigManager.addConfig(imageUploadConfig);
		abstractConfigManager.addConfig(emailConfig);
		abstractConfigManager.addConfig(jpushConfig);
		abstractConfigManager.addConfig(redisConfig);
		abstractConfigManager.addConfig(systemKeyConfig);
		abstractConfigManager.addConfig(queue_config);
		abstractConfigManager.addConfig(wechat_pay);
		abstractConfigManager.addConfig(systemConfig);
		abstractConfigManager.notifyIntitalConfig();

	}

	public void intital(String clienType) {

		System.out.println(clienType);

	}

}
